//# sourceURL=user-permission-info.js


$(function(){
	
	
	

})


/*
 * 保存权限信息
 */
function savePermission(){
	var roles = getCheckRole();
	var depts = getCheckDept();
	if(roles != "" || depts != ""){
		$.ajax({
			type: 'post',
			url: "admin/user/permission",
			dataType: 'json',
			data : {'userId':$('#userId').val(),'roles':roles,'depts':depts},
			success: function(result){
				parent.layer.msg(result.message,{icon:1,time:2000});
				var index = parent.layer.getFrameIndex(window.name);
				parent.layer.close(index);
			},
			error:function(data) {
				console.log(data.message);
			},
		});	
	}
}

/*
 * 获取被选中的角色
 */
function getCheckRole(){
	var roles = "";
	var i = 0;
	$('#roleList input[name="role"]:checked').each(function(){
		roles += $(this).val() + ",";
	});
	return roles;
}


/*
 * 获取被选中的科室
 */
function getCheckDept(){
	var depts = "";
	var i = 0;
	$('#deptList input[name="dept"]:checked').each(function(){
		depts += $(this).val() + ",";
	});
	return depts;
}


